<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, minimal-ui">
    <title>MobioKit - Premium Mobile Template</title>
    <link rel="stylesheet" href="../../vendor/swiper/swiper.min.css">
    <link rel="stylesheet" href="css/style.css">

</head>

<body>

    <!-- Overlay panel -->
    <div class="body-overlay"></div>
    <!-- Left panel -->
    <div id="panel-left"></div>
    <!-- Right panel -->
    <div id="panel-right"></div>


    <div class="page page--main" data-page="tables" id='app'>

        <header class="header header--page header--fixed">
            <div class="header__inner">
                <div class="header__icon">
                    <a href="../../../index.html"><img src="../../assets/images/icons/white/arrow-back.svg" alt="" title="" /></a>
                </div>
                <div class="header__logo header__logo--text"><a href="#">检查记录</a></div>
                <div class="header__icon header__icon--empty-space"></div>

            </div>
        </header>

        <!-- PAGE CONTENT -->
        <div class="page__content page__content--with-header">

            <h2 class="page__title">检查记录</h2>
            <!-- 
            <p class="welcome">
            </p> -->

            <div class="table table--4cols mb-20">
                <div class="table__inner">
                    <div class="table__row">
                        <div class="table__section table__section--header" style="text-align: center;">序号</div>
                        <div class="table__section table__section--header" style="text-align: center;">名称</div>
                        <div class="table__section table__section--header" style="text-align: center;">开始时间</div>
                        <div class="table__section table__section--header" style="text-align: center;">是否整改</div>
                        <!-- <div class="table__section table__section--header">Option</div>
                        <div class="table__section table__section--header">Button</div> -->
                    </div>
                    <div v-for="(item,i) in dataList" class="table__row" @click="getInfo(item)">
                        <div class="table__section" style="text-align: center;">{{i+1}}</div>
                        <div class="table__section" style="text-align: center;">{{item.TESTNAME}}</div>
                        <div class="table__section" style="text-align: center;">{{formatDate(item.CREATETIME)}}</div>
                        <div class="table__section" style="text-align: center;">{{item.ISRECTIFY===1?'是':'否'}}</div>

                        <!-- <div class="table__section">{{item.INSTRUMENTNAME}}</div>
                        <div class="table__section">{{item.INSTRUMENTNAME}}</div> -->
                    </div>

                </div>
            </div>


        </div>




    </div>
    <!-- PAGE END -->

    <!-- Social Icons Popup -->
    <div id="popup-social"></div>

    <!-- Alert -->
    <div id="popup-alert"></div>

    <!-- Notifications -->
    <div id="popup-notifications"></div>

    <script src="../../vendor/jquery/jquery-3.5.1.min.js"></script>
    <script src="../../vendor/jquery/jquery.validate.min.js"></script>
    <script src="../../vendor/swiper/swiper.min.js"></script>
    <script src="js/swiper-init.js"></script>
    <script src="js/jquery.custom.js"></script>
</body>



<script src="../../../js/vue/vue.js"></script>
<!-- <script src="js/iview/iview.min.js"></script> -->
<script src="../../../js/jsCookie/js.cookie.min.js"></script>
<script src="../../../js/axios/axios.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/vant@2.12/lib/vant.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.12/lib/index.css" />





<script>
    var app = new Vue({
        el: '#app',
        data: {
            user: {},
            dataList: [],
        },
        methods: {
            getCookieUser() {
                let userJson = Cookies.get('userInfo');
                if (!userJson) {
                    this.$notify({
                        type: 'danger',
                        message: '请先登录'
                    });
                    window.location.href = '../../../../login.html'
                    return
                }
                this.user = JSON.parse(userJson)
                if (!this.user) {
                    this.$notify({
                        type: 'danger',
                        message: '请先登录'
                    });
                    window.location.href = '../../../../login.html'
                    return
                }
                this.getDataTable()
            },
            formatDate(date) {
                var date = new Date(date);
                var YY = date.getFullYear() + '-';
                var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
                var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
                var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
                var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
                var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
                return YY + MM + DD + " " + hh + mm + ss;
            },
            getInfo(item) {
                window.location.href = '/yy/demos/main/checkInfo.html?cid=' + item.ID
                Cookies.set("checkItem", item, {
                    expires: 7,
                });

            },
            getDataTable() {
                let formData = new FormData();
                formData.append("createId", this.user.id);
                axios
                    .post(
                        "http://10.11.41.128:30010/checkDay/findCheckDay?ticket=" + Cookies.get('ticket'),
                        formData, {
                            headers: {
                                "Content-Type": "multipart/form-data",
                                "token": this.user.token,
                            },
                        }
                    )
                    .then(res => {
                        if (res.data === null || res.data === " ") return;
                        if (res.data.status === 1) {
                            console.log(res.data)
                            this.dataList = res.data.data.dataList

                        } else {
                            this.$notify({
                                type: 'danger',
                                message: '加载失败' + res.data.msg
                            });
                            if (res.data.msg === "未登录") {
                                window.location.href = "../../../../login.html"
                            }
                        }
                    });
            },



        },
        mounted: function() {
            this.getCookieUser()

        }
    })
</script>

</html>